import request from '@/utils/request'

// 字典数据
export const getDictionaryInit = data => {
  return request({
    url: '/common-server/dictionaryItem/getDictionaryInit',
    method: 'get',
    params: data
  })
}

export const getDictionaryItemList = data => {
  return request({
    url: '/common-server/dictionaryItem/getDictionaryItemList',
    method: 'get',
    params: data
  })
}

// 获取字典列表
export const getDictionaryItemMap = data => {
  return request({
    url: '/common-server/dictionaryItem/getDictionaryItemMap',
    method: 'get',
    params: data
  })
}

// 获取字典树
export const getDictionaryItemTree = data => {
  return request({
    url: `/common-server/dictionaryItem/getDictionaryItemTree/${data.code}`,
    method: 'get',
    params: {}
  })
}

export const dictionaryItemList = data => {
  return request({
    url: '/common-server/dictionary/itemPage',
    method: 'post',
    data
  })
}

export const dictionaryList = data => {
  return request({
    url: '/common-server/dictionary/page',
    method: 'post',
    data
  })
}

export const dictionaryDel = data => {
  return request({
    url: '/common-server/dictionary/delete',
    method: 'post',
    data
  })
}

export const dictionaryAdd = data => {
  return request({
    url: '/common-server/dictionary/add',
    method: 'post',
    data
  })
}

export const dictionaryUpdate = data => {
  return request({
    url: '/common-server/dictionary/update',
    method: 'post',
    data
  })
}

export const dictionaryItemDel = data => {
  return request({
    url: '/common-server/dictionary/deleteItem',
    method: 'post',
    data
  })
}

export const dictionaryItemAdd = data => {
  return request({
    url: '/common-server/dictionary/addItem',
    method: 'post',
    data
  })
}

export const dictionaryItemUpdate = data => {
  return request({
    url: '/common-server/dictionary/updateItem',
    method: 'post',
    data
  })
}